package com.auxteam.elope;

import com.auxteam.elope.activities.ExampleListActivity;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

public class WelcomeMenu extends Activity implements OnClickListener{
	Button btnMenuLogin;
	Button btnMenuSignUp;
	Button btnMenuGoToApp;
	ImageView imgElope;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_welcome_menu);
		
		AlphaAnimation  blinkanimation= new AlphaAnimation(1, 0.70f); // Change alpha from fully visible to invisible
		blinkanimation.setDuration(2000); // duration - half a second
		blinkanimation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
		blinkanimation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
		blinkanimation.setRepeatMode(Animation.REVERSE);
		
		imgElope = (ImageView) findViewById(R.id.imageView1);
		btnMenuLogin = (Button) findViewById(R.id.btnMenuLogin);
		btnMenuSignUp = (Button) findViewById(R.id.btnMenuSignUp);
		btnMenuGoToApp = (Button) findViewById(R.id.btnMenuGoToApp);
		
		btnMenuLogin.setOnClickListener(this);
		btnMenuSignUp.setOnClickListener(this);
		btnMenuGoToApp.setOnClickListener(this);
		imgElope.setAnimation(blinkanimation);
	}

	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub
		finish();
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.welcom_menu, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v == btnMenuLogin){
			startActivity(new Intent(getApplicationContext(), LoginActivity.class));
			finish();
		}
		else if(v == btnMenuGoToApp){
			startActivity(new Intent(getApplicationContext(), DefaultHomeScreen.class));
			finish();
		}
		else if(v == btnMenuSignUp){
			Toast.makeText(getApplicationContext(), "Sign Up Page", Toast.LENGTH_SHORT).show();
		}
	}

}